import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        isLoginShow: false,
        isFromLogin: false,
        routeTarget: '',
        isWeather: false,
        weatherType: 'RDCP/medium/SEVP_AOC_RDCP_SLDAS_EBREF_ACCN_L88_PI' //1为卫星云图 2为雷达图
    },
    mutations: {
        TOGGLE_LOGIN_SHOW(state, val) {
            state.isLoginShow = val;
        },
        SET_FROM_LOGIN(state, val) {
            state.isFromLogin = val;
        },
        SET_ROUTE_TARGET(state, val) {
            state.routeTarget = val
        },
        TOGGLE_WEATHER_SHOW(state, val) {
            state.isWeather = !!val;
            debugger;
            if (val == '1')
                state.weatherType = 'WXCL/SEVP_NSMC_WXCL_ASC_E99_ACHN_LNO_PY'
            else if (val == '2')
                state.weatherType = 'RDCP/medium/SEVP_AOC_RDCP_SLDAS_EBREF_ACCN_L88_PI'
        }
    },
    strict: process.env.NODE_ENV !== 'production',
})

export default store